package day11.setdemo;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.Tuple;

import java.util.Set;

public class LolBoxViewer {
    private static Jedis jedis = new Jedis("master", 6379);
    public static void main(String[] args) throws InterruptedException {
        int count = 1;
        while (true){
            Thread.sleep(2000);
            System.out.println("第" + count + "次查看榜单");
            // 从redis中获取榜单排名信息，取4名
            Set<Tuple> heros = jedis.zrevrangeWithScores("hero:ccl", 0, 3);
            for (Tuple hero : heros){
                System.out.println(hero.getElement() + "----------------" + hero.getScore());
            }
            count++;
        }
    }
}
